import Notify from "../../miniprogram_npm/@vant/weapp/notify/notify";
import { Banner } from "../../viewmodel";

// pages/home/index.ts
const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    bannerList: <Banner[]>[
      {
        id: "banner001",
        imgUrl: "/assets/images/banner/banner_01.jpg",
      },
      {
        id: "banner002",
        imgUrl: "/assets/images/banner/banner_02.jpg",
      },
      {
        id: "banner003",
        imgUrl: "/assets/images/banner/banner_03.jpg",
      },
      {
        id: "banner004",
        imgUrl: "/assets/images/banner/banner_04.jpg",
      },
    ],
  },
  // 喊上林小友出门吃饭
  orderDinner() {
    // TODO =>页面跳转 喊上林小友出门吃饭

    Notify({
      message: "已通知林小友!!\n他正在赶来的路上",
      color: "#f0f0f0",
      background: "#1677ff",
      safeAreaInsetTop: true,
      duration: 2000,
    });
  },
  // 召唤林小友
  summonDinner() {
    // TODO =>页面跳转 召唤林小友买菜
    Notify({
      message: "召唤林小友成功~",
      color: "#f0f0f0",
      background: "#1677ff",
      duration: 2000,
      safeAreaInsetTop: true,
    });
  },

  showVip() {
    // TODO => 页面跳转 展示会员码
    wx.showToast({ title: "展示二维码ing...", icon: "none" });
  },

  setWish() {
    // TODO 页面跳转 =>许愿
    console.log('我现在去许愿啦')
  },

  
  goWishShop(){
    // TODO 页面跳转 => 去实现愿望
    console.log('我现在去实现愿望啦')
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    // 设置安全区域高度
    this.setData({ statusBarHeight: app.statusBarHeight });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() { },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() { },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() { },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() { },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() { },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() { },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() { },
});
